#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
import shutil

"""
shutil.copyfileobj(open("05-sys.py", "r"), open("05-sys.1.py", "w"))

with open("05-sys.py", "r") as read_f, open("05-sys.2.py", "w") as write_f:
    shutil.copyfileobj(read_f, write_f)


shutil.copyfile("05-sys.py", "05-sys.1.py")
shutil.copymode("05-sys.py", "05-sys.1.py")


import os

up_dir = os.path.dirname(os.path.dirname(__file__))
module = os.path.join(up_dir, "03-模块")
new_dir = os.path.join(up_dir, "new")
new_name_dir = os.path.join(up_dir, "newname")
# 目标目录不能存在，注意对folder2目录父级目录要有可写权限，ignore的意思是排除
# shutil.copytree(module, new_dir, ignore=shutil.ignore_patterns("*.txt", "*.wrapper.*"))
# shutil.rmtree(new_dir)

shutil.move(new_dir, new_name_dir)
"""


import os
up_dir = os.path.dirname(os.path.dirname(__file__))
module = os.path.join(up_dir, "03-模块")
shutil.make_archive("module", format="tar", root_dir=module)
